<?php
//register asset files
//register javascript
//extract variables
//$sender = $_REQUEST['message_sender'];

if (isset($_REQUEST['MessageFormModel'])) {
    $receiver = $_REQUEST['MessageFormModel']['sendTo'];
    $messageData = $_REQUEST['MessageFormModel']['messageBody'];

    $opContract = new BOCServiceMessage();

    $opContract->sendOperationRequest(
            array('name'=>BOCServiceMessage::Operation_SendMessage,'data'=>array('message' => $messageData)), 
            $receiver, 
            NULL);
}
?>

<style TYPE="text/css">
    .messagebox {
        padding: 8px;
        background-color: #F7F7F9;
        border: 1px solid #E1E1E8;
    }
</style>
<?php
$screen = Blyn::app()->getCurrentNode()->getUIManager()->getCurrentScreen();
$messages = $screen->getMessages();
foreach ($messages as $message) {
//for ($index = 0; $index < 3; $index++) {
    ?>
    <div class="row-fluid" style="margin-top: 15px">
        <div class="span2"><a title="hi" href="#" accesskey="q" class="avatar" boss="btnWideSideHeadImage" hidefocus="true">
                <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/qie.jpg" width="50" height="50"></a></div>
        <div class="span10 messagebox" style="margin-left: -10px;" >
            <?php echo $message ?>
        </div>
    </div>
<?php } ?>
